function fourier_mask = radialSqrt (img,angl)
%window with fading region shaped according to the sqrt of the distance to
%the angl
%
%author Sebastian Schmelcher  version: 2012-03-20


angl=angl*pi/180;
[n,m]=size(img);
origin=get_origin([n,m]);
[X,Y]=meshgrid(1-origin(1):n-origin(1),1-origin(2):m-origin(2));
[theta,rad]=cart2pol(X,Y);


fourier_mask=((abs(theta)<=angl)+(abs(theta)>=pi-angl));


max_dist=2*sqrt(rad);
distance=sin(angle(exp(1i*(-angl-theta)))).*rad;
fourier_mask=fourier_mask+((theta<-angl).*(theta>=-pi/2).*(distance<=max_dist).*(abs(max_dist-distance)./max_dist));
fourier_mask=fourier_mask+((theta<pi-angl).*(theta>pi/2).*(distance>=-max_dist).*(abs(max_dist+distance)./max_dist));  

distance=sin(angle(exp(1i*(angl-theta)))).*rad;
fourier_mask=fourier_mask+((theta<=pi/2).*(theta>angl).*(distance>=-max_dist).*(abs(max_dist+distance)./max_dist)); 
fourier_mask=fourier_mask+((theta<-pi/2).*(theta>-pi+angl).*(distance<=max_dist).*(abs(max_dist-distance)./max_dist));  

if(true)
    fourier_mask(origin(1)-1:origin(1)+1,origin(2)-1:origin(2)+1)=ones(3,3);%img(origin(1)-1:origin(1)+1,origin(2)-1:origin(2)+1);
end





   


